home *** CD-ROM | disk | FTP | other *** search
/ Aminet 48 / Aminet 48 (2002)(GTI - Schatztruhe)[!][Apr 2002].iso / Aminet / dev / mui / urltext.lha / Urltext / Sources / mcc / init.c < prev    next >
Encoding:
C/C++ Source or Header  |  2002-01-25  |  2.2 KB  |  100 lines

  1.  
  2. #include "class.h"
  3.  
  4. /****************************************************************************/
  5.  
  6. SAVEDS ASM ULONG
  7. query(REG(d0) LONG which)
  8. {
  9.     switch (which)
  10.     {
  11.         case 0:
  12.             return (ULONG)UrltextBase->mcc;
  13.  
  14.         default:
  15.             return 0;
  16.     }
  17. }
  18.  
  19. /****************************************************************************/
  20.  
  21. void ASM
  22. freeBase(REG(a0) struct UrltextBase *base)
  23. {
  24.     if (base->localeBase)
  25.     {
  26.         if (base->cat)
  27.         {
  28.             CloseCatalog(base->cat);
  29.             base->cat = NULL;
  30.         }
  31.  
  32.         CloseLibrary(base->localeBase);
  33.         base->localeBase = NULL;
  34.     }
  35.  
  36.     if (base->openURLBase)
  37.     {
  38.         CloseLibrary(base->openURLBase);
  39.         base->openURLBase = NULL;
  40.     }
  41.  
  42.     if (base->diskFontBase)
  43.     {
  44.         CloseLibrary(base->diskFontBase);
  45.         base->diskFontBase = NULL;
  46.     }
  47.  
  48.     if (base->iFFParseBase)
  49.     {
  50.         CloseLibrary(base->iFFParseBase);
  51.         base->iFFParseBase = NULL;
  52.     }
  53.  
  54.     if (base->muiMasterBase)
  55.     {
  56.         if (base->mcc)
  57.         {
  58.             MUI_DeleteCustomClass(base->mcc);
  59.             base->mcc = NULL;
  60.         }
  61.  
  62.         CloseLibrary(base->muiMasterBase);
  63.         base->muiMasterBase = NULL;
  64.     }
  65.  
  66.     base->flags &= ~BASEFLG_INIT;
  67. }
  68.  
  69. /***********************************************************************/
  70.  
  71. BOOL ASM
  72. initBase(REG(a0) struct UrltextBase *base)
  73. {
  74.     if ((base->muiMasterBase = OpenLibrary("muimaster.library",0)) &&
  75.         (base->iFFParseBase = OpenLibrary("iffparse.library",0L)) &&
  76.         (base->diskFontBase = OpenLibrary("diskfont.library",0)) &&
  77.         initMCC(base))
  78.     {
  79.         base->dosBase       = (APTR)base->mcc->mcc_DOSBase;
  80.         base->utilityBase   = base->mcc->mcc_UtilityBase;
  81.         base->intuitionBase = (APTR)base->mcc->mcc_IntuitionBase;
  82.         base->gfxBase       = base->mcc->mcc_GfxBase;
  83.  
  84.         base->openURLBase  = OpenLibrary("openurl.library",0);
  85.  
  86.         if (base->localeBase = OpenLibrary("locale.library",0))
  87.             base->cat = OpenCatalogA(NULL,CATNAME,NULL);
  88.  
  89.         base->flags |= BASEFLG_INIT;
  90.  
  91.         return TRUE;
  92.     }
  93.  
  94.     freeBase(base);
  95.  
  96.     return FALSE;
  97. }
  98.  
  99. /***********************************************************************/
  100.